<?php 
class CartAdmin extends Module
{
	function CartAdmin($row)
	{
		Module::Module($row);
		
		if(User::have_permit(ADMIN_ITEM))
		{
			$cmd	=	Url::get('cmd');
			
			switch($cmd)
			{
				case 'delete':
					if(User::is_admin())
					{		
						$id	=	Url::get('id',0);
						
						if($id)
						{
							DB::delete("cart","id=$id");
						}
					}
					
					Url::redirect_current();
					break;
				case 
					'edit':
					require_once 'forms/CartEdit.php';				
					$this->add_form(new CartEditForm());
					break;
					
				case '':
				default:	
					require_once 'forms/CartAdmin.php';			
					$this->add_form(new CartAdminForm());
					break;
			}
		}
		else
		{
			Url::access_denied();
		}
	}
}
?>